package org.petstore.domain;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Log {
    private static Date data;
    protected static StringBuilder bb=new StringBuilder();

    synchronized public static String log(Object ...s) {
        bb.delete(0, bb.length());//删除原来的信息
        bb.append(time());//添加时间
        bb.append("    ");//添加空格

        for(Object str : s) {
            bb.append(str);
            bb.append(" ");
        }
        return bb.toString();
    }

    public static String logInfomation(Object ...s){
        return log(s);
    }

    protected static String time() {
        data = new Date();
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data);
    }
}
